<template>
  <div class="weekend">
    <div class="title">周末去哪儿</div>
    <ul>
      <li :key="item.id" class="item border-bottom" v-for="item of weekendList">
        <div class="icon-img-wrapper">
          <img :src="item.imgUrl" class="item-img">
        </div>
        <div class="item-info">
          <p class="item-title">{{item.title}}</p>
          <p class="item-desc">{{item.desc}}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script type="text/javascript">
  export default {
    name: 'HomeWeekend',
    props: {
      weekendList: Array
    },
    data () {
      return {}
    },
    computed: {}
  }
</script>
<!-- 后面的scoped是必须的，表示它只对当前组件有效，不会影响到其他组件的样式 -->
<style lang="stylus" scoped>
  @import "../../../assets/styles/variables.styl"

  .title
    line-height: .8rem
    background: #eee
    text-indent: .2rem

  .icon-img-wrapper
    overflow: hidden
    height: 33.9vw

  .item-img
    width: 100%
    height: 3rem
    padding: .1rem

  .item-info
    padding: .1rem
    /* 重点，如果没有这个min-width，ellipsis就不会出现“...”，如果容器的宽度小于 flex item 本身的宽度，flex item 会拒绝收缩，除非你给 flex item 的min-width、max-width或width指定一个值 */
    min-width: 0

    .item-title
      line-height: .54rem
      font-size: .32rem
      ellipsis()

    .item-desc
      line-height: .4rem
      color: #ccc
      ellipsis()

</style>
